package acwing.动态规划.线性;

import java.util.Scanner;

/**
 * 最长上升子序列
 *
 * @author yang
 * @date 2022/1/18
 */
public class 最长上升子序列 {

    static int N = 1010;
    static int[] arr = new int[N];
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            arr[i] = sc.nextInt();
        }
        int[] f = new int[N];
        int max = -1;
        for (int i = 1; i <= n; i++) {
            f[i] = 1;
            for (int j = 1; j <= i; j++) {
                if (arr[i] > arr[j]) f[i] = Math.max(f[i], f[j] + 1);
            }
            max = Math.max(max, f[i]);
        }
        System.out.println(max);
    }
}
